package org.footballmanager.pandafootball.system.form.impl;

import lombok.Getter;
import lombok.Setter;
import org.footballmanager.pandafootball.system.domain.FootDj;
import org.footballmanager.pandafootball.system.form.SearchForm;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example;

import java.io.Serializable;

@Setter
@Getter
public class FootDjSearchForm extends SearchForm implements Serializable {
	private static final long serialVersionUID = 8090668615941861527L;
	protected String djbm;
	protected Double qysj;

	public Example buildSearchCommond() {
		Example example = new Example(FootDj.class);
		Example.Criteria criteria = example.createCriteria();
		if (!StringUtils.isEmpty(djbm)) {
			criteria.andLike("djbm", "%" + djbm.trim() + "%");
			Example.Criteria criteria2 = example.createCriteria();
			criteria2.andEqualTo("qydj", djbm.trim());
			example.or(criteria2);
		}
		if(qysj != null){
			criteria.andEqualTo("qysj", qysj);
		}
        criteria.andEqualTo("delFlag", 0);
		example.orderBy("djbm desc");
		return example;
	}

}
